package com.ruoyi.business.controller;

import com.ruoyi.business.service.IBizPayOrderService;
import com.ruoyi.common.core.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 兑现申请记录Controller
 *
 * @author ruoyi
 * @date 2020-09-23
 */
@Controller
@RequestMapping("/ajax")
public class AlipayController extends BaseController
{
    @Resource
    private IBizPayOrderService bizPayOrderService;

    /**
     * 支付宝提交
     */
    @GetMapping("/pay")
    public String pay(Long id, ModelMap mmap, HttpServletRequest request)
    {
        String userAgent = request.getHeader("user-agent");
        if (userAgent.contains("MicroMessenger")) {
            mmap.put("form", "");
        } else {
            mmap.put("form", bizPayOrderService.selectZfbForm(id));
        }
        return "business/pay/pay";
    }
}
